<?php
include "../config/koneksi.php";
include "../class/produk.php";
include "../class/kategori.php";
include "../class/toko.php";

$produk_dao=new Produk_Dao();
$list=$produk_dao->get_all();
$Kategori_Dao=new Kategori_Dao();
$kategori=$Kategori_Dao->get_all();
$Toko_Dao=new Toko_Dao();
$toko=$Toko_Dao->get_all();
$Produk_Dao=new Produk_Dao();
$produk=$Produk_Dao->get_toko($_SESSION['Id']);
?>
<html>
<head>
<title>List Produk</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
  <tr> 
      
    <td height="30""> 
      <div align="left"><font size="3" face="tahoma">Manajemen Produk</font><br></font><hr color=#CCCCFF>
      <a href=index.php?menu=input_produk>
<input type=submit value="Tambah Produk"></a></div></td>
    </tr>
  </table>
  <br>
<div align=center>
	<table class="table table-bordered">

<div align=center>
<table border=1 cellpadding=0 cellspacing=0 style=border-collapse: collapse width=100% id=AutoNumber1>
		<tr>
			<td width=3% bgcolor=#999999>
			<font face=Tahoma color=#FFFFFF size=2>No.</font></td>
			<td width=17% bgcolor=#999999 align=center>
			<font face=Tahoma color=#FFFFFF size=2>Kategori</font></td>
			<td bgcolor=#999999 align=center style=border-style: none; border-width: medium width=15%>
			<font face=Tahoma color=#FFFFFF size=2>Toko</font></td>
			<td bgcolor=#999999 align=center style=border-style: none; border-width: medium width=10%>
			<font face=Tahoma color=#FFFFFF size=2>Nama Oleh2</font></td>
			<td bgcolor=#999999 align=center style=border-style: none; border-width: medium width=10%>
			<font face=Tahoma color=#FFFFFF size=2>Harga</font></td>
			<td bgcolor=#999999 align=center style=border-style: none; border-width: medium width=10%>
			<font face=Tahoma color=#FFFFFF size=2>Gambar</font></td>
			<td bgcolor=#999999 align=center style=border-style: none; border-width: medium width=70%>
			<font face=Tahoma color=#FFFFFF size=2>Detil</font></td>
			
			<td bgcolor=#999999 align=center style=border-style: none; border-width: medium colspan=3 width=15%>
			<font face=Tahoma color=#FFFFFF size=2>Aksi</font></td>
		</tr>
			
	<?php
	$i=1;
	foreach($produk as $list2){
	$id_oleh2=$list2->id_oleh2;
	$Kategori_Dao=new Kategori_Dao();
    $kategori=$Kategori_Dao->get($list2->id_kategori);
	$Toko_Dao=new Toko_Dao();
    $toko=$Toko_Dao->get($list2->id_toko);
	?>
	<tr>
		<td width=3% style=border-style: none; border-width: medium align=center valign=top><font face=Tahoma size=2><?php echo $i;?></font></td>
		<td style=border-style: none; border-width: medium width=17% align=center valign=top><font face=Tahoma size=2><?php echo ucwords ($kategori->kategori); ?></font></td>
		<td style=border-style: none; border-width: medium width=17% align=center valign=top><font face=Tahoma size=2><?php echo ucwords ($toko->nama_toko); ?></font></td>
		<td style=border-style: none; border-width: medium width=10% align=center valign=top><font face=Tahoma size=2><?php echo $list2->nama_oleh2; ?></font></td>
		<td style=border-style: none; border-width: medium width=10% align=center valign=top><font face=Tahoma size=2>Rp.<?php echo $list2->harga; ?></font></td>
		<th><?php echo "<image src=\"../images/gambar_produk/$list2->gambar\" width=100 height=150>"; ?></t>
		<td style=border-style: none; border-width: medium width=70% align=left valign=top><font face=Tahoma size=2><?php echo $list2->detil; ?></font></td>
		<td><?php echo "<a href=index.php?menu=edit_produk&id_oleh2=$id_oleh2 title='Edit Produk'><img border=0 src=../images/edit.png></a>";?></td>
		<td><?php echo "<a href=index.php?menu=hapus_produk&id_oleh2=$id_oleh2 title='Hapus Produk'><img border=0 src=../images/delete.png></a>";?> </td>
	</tr>
<?php $i++;}?>

	</table>
</body>
</html>